package CryptoPrim;

import Utils.TypeConvertionUtils;
import ArithmeticObjects.VerfGroup;
import ArithUtils.Array;

/**
 * A class which represents a ciphertext as Gq^w x Gq^w
 * 
 * @author Itamar Carmel, nirhagin
 */
public class Ciphertext {
	
	// suppose w = (u,v); w - width
	private Array<VerfGroup.VElement> elmArr1; // u = (u1,..,uw)
	private Array<VerfGroup.VElement> elmArr2; // v = (v1,..,vw)
	
	/**
	 * Constructor of Ciphertext from two arrays (both of the same width).
	 * 
	 * @param a - u
	 * @param b - v
	 */
	public Ciphertext(Array<VerfGroup.VElement> a, Array<VerfGroup.VElement> b) {
		this.elmArr1 = a;
		this.elmArr2 = b;
	}
	
	/**
	 * Constructor of Ciphertext which initiates both arrays (u and v).
	 */
	public Ciphertext(){
		this.elmArr1 = new Array<VerfGroup.VElement>();
		this.elmArr2 = new Array<VerfGroup.VElement>();
	}

	/**
	 * Getter fot this ciphertext width.
	 * 
	 * @return w (width of ciphertext)
	 */
	public int getWidth() {
		return TypeConvertionUtils.bigNumberToInt(this.elmArr1.getLength());
	}

	/**
	 * Getter for u (array of elements).
	 * 
	 * @return u
	 */
	public Array<VerfGroup.VElement> getA() {
		return this.elmArr1;
	}
	
	/**
	 * Getter for v (array of elements).
	 * 
	 * @return v
	 */
	public Array<VerfGroup.VElement> getB() {
		return this.elmArr2;
	}

	/**
	 * Add a pair to the ciphertext.
	 * 
	 * @param a - u[w+1]
	 * @param b - v[w+1]
	 */
	public void add(VerfGroup.VElement a, VerfGroup.VElement b) {
		this.elmArr1.add(a);
		this.elmArr2.add(b);
	}
}
